{template header}
<link rel="stylesheet" href="static/calendar/js/calendar.css" />
<script type="text/javascript" charset="utf-8" src="static/calendar/calendar.php"></script>
<style>
    .hp-visited a:visited{color: #444;}
    .input-append button{font-size:12px;}
    select,.f12{font-size:12px;}
    #no_user,#user_show{display:none;}
</style>
<div style="clear:both">
    <h5>
        <span class="add-on"><i class="icon-calendar"></i> 添加推送 </span>
        <span class="add-on">
            <code><a href="./?c=admin&a=bbsPushList">返回列表</a></code>
        </span>
    </h5>
</div>

<table class="table table-striped table-bordered table-hover" height="300"><tr><td>
<div style="clear:both;margin: 50px;">
    {if !empty($msg)}
    <div class="alert alert-warn">
        {$msg}
    </div>
    {/if}
    <form class="form-horizontal" method="post" onsubmit="return check()">
        <div class="control-group">
            <label class="control-label" for="id">帖子ID </label>
            <div class="controls">
               <div> <input name="id" onkeyup="this.value=this.value.replace(/\D/g,'')" onfocus="$('#user_show').hide()" type="text" id="id" placeholder="帖子ID只能为数字" style="font-size:12px;"><code id="user_show">ID不能为空！</code></div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="name">标题 </label>
            <div class="controls">
                <div><input class="input-lg" id="title" type="text" disabled placeholder="帖子标题" style="font-size:12px;"> <code id="no_user">这个帖子被兔子吃了！</code></div>
            </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="inputShortDesc">推送定时：</label>
          <div class="controls">
            <input type="text" name="push_time" readonly="readonly" id="send_time_id" value="">
            <input name="send_time_btn" type="button" id="send_time_btn" onclick="return showCalendar('send_time_id', '%Y-%m-%d %H:%M:%S', '24', false, 'send_time_btn');" value="选择" class="button" id="send_time_id"/>
          </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="name">性别 </label>
            <div class="controls">
                <select name="gender">
                    <option value="0">不限</option>
                    <option value="1">男</option>
                    <option value="2">女</option>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="name">城市 </label>
            <div class="controls">
                <input class="input-lg" name="city" type="text" placeholder="">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="name">用户ID </label>
            <div class="controls">
                <textarea name="uids" placeholder="输入要推送的用户ID，多个ID以'|'分隔，输入后只对相应ID的用户推送"></textarea>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputStatus"></label>
            <div class="controls">
                <input type="submit" id="inputSubmit" class="btn btn-primary" value="提交">&nbsp;&nbsp;
                <input type="reset" id="inputreset" class="btn btn-inverse" value="重置">
            </div>
        </div>
    </form>
</div>
</td></tr></table>

<script type="text/javascript">
    function check(){
        var val = $('#id').val();
        if(val.length <= 0){
            $('#user_show').show();
            return false;
        }
    }
    $("#id").blur(function(){
        var id = $(this).val();
        $("#no_user").hide();
        var that = this;
        $.getJSON('?c=admin&a=getNewsInfo',{id:id},function(data){
            if(data.code == 200){
                $("#title").val(data.title);
            }else{
                $("#no_user").html(data.msg).show();
                $(that).focus().val('');
            }
        });
    });
</script>

{template footer}